package com.jixu.numberapp.utils;

import java.util.Random;


/**
 * Title:
 * Description:
 * Create Time: 2023/2/21 16:23
 *
 * @version 1.0
 * @author: aaa
 */
public class NumberUtils {
    static Random random = new Random();

    /**
     * 获取猜测的32位数字
     *
     * @return
     */
    public static String getNumber(int length) {

        String number = "";
        for (int i = 0; i < length; i++) {
            // 生成 0-9 随机整数
            String n = String.valueOf(random.nextInt(10));
            number += n;
        }
        return number;
    }

    /**
     * 获取猜测的数字
     *
     * @return
     */
    public static Integer getGuessNumber() {
        return random.nextInt(10);
    }

    /**
     * 猜测位数
     *
     * @return
     */
    public static int getFiguresNumber(int start, int end) {
        return start + (int) (Math.random() * (end - start));
    }

    public static void main(String[] args) {
        for (int i = 0; i < 1000; i++) {
            int figuresNumber = getFiguresNumber(0, 31);
            System.out.println(figuresNumber);
            if (figuresNumber  > 32) {
                System.out.println(figuresNumber);
                System.out.println("ssssssssss");
            } else if (i < 0) {
                System.out.println("小于0");
            }

        }

    }
}
